<script type="text/javascript">

$(".onover").mouseover(function(){
	$( this ).addClass( "bg-color-orange" );
	});
$(".onover").mouseout(function(){
	$( this ).toggleClass( "bg-color-orange" );
	});
</script>

<g:if test="${fileList }">
<%--controllo su id pratica--%>
<h1 class="page-title txt-color-blueDark animated bounceInRight fast">
	<i class="fa fa-folder-open-o fa-fw "></i> ${fileList.get(0).documentType.documentType} 
</h1>
	
	<div class="row">
			
		<div class="col col-md-5">
			
			<a  onclick="show_files('${fileList.get(0).documentType.id}','name')" class="btn btn-xs bg-color-blueLight txt-color-white pull-right">Ordina per Nome</a>	
		
		</div>
			
		<div class="col col-md-5">
			
			<a  onclick="show_files('${fileList.get(0).documentType.id}','date')" class="btn btn-xs bg-color-teal txt-color-white pull-right">Ordina per data creazione</a>	
		
		</div>	
			
	</div>
	<br>
	
	<g:each in="${fileList}" var="file">
		
		<div class="col-sm-12 col-md-12 ">
						
					<div class="well well-sm animated bounceInRight fast onover">
						
						<div class="row">
							
							<div class="col-sm-12 col-md-6">
							
								
								<exdutility:truncateText stringIn="${file.fileName}" max-size="36"/>
							
							</div>
							<div class="col-sm-12 col-md-6 pull-right">
							
								 <a  data-toggle="tooltip" title="Scarica il File" href="${createLink(action:'downloadFile',params:[fileId:file.id,praticaId:praticaId])}" class="btn btn-success btn-circle pull-right"><i class="glyphicon glyphicon-cloud-download"></i></a>
								<a data-toggle="tooltip" title="Dettagli sul File" onclick="showfDetails('${file.id}')"  href="javascript:void(0);" class="btn btn-primary btn-circle pull-right"><i class="glyphicon glyphicon-info-sign"></i></a>
								<sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_AMM">
								<a data-toggle="tooltip" title="Elimina File" onclick="fileCancelAlert(${file.id},${praticaId},${file.documentType.id })" class="btn btn-danger btn-circle pull-right"><i class="glyphicon glyphicon-trash"></i></a>
							</sec:ifAnyGranted>
							<i style="display:none" id="spin_${file.id}" class="fa fa-lg fa-refresh fa-spin "></i>
								
							</div>
						
						</div>
											
						
				
					</div>
				</div>

	</g:each>

</g:if>
<g:else>
	
	<h1 class="page-title txt-color-blueDark">
		<i class="fa fa-folder-open-o fa-fw "></i> ${folderType?.documentType} 
	</h1>
		
	<div class="alert alert-info fade in col col-md-5 col-md-offset-1 animated bounceInRight fast">
				
		<i class="fa-fw fa fa-info"></i>
		<strong>Questa cartella è vuota</strong> 
	</div> 

</g:else>



